package com.cloud.mall.entity;

import com.baomidou.mybatisplus.annotation.*;

import java.time.LocalDateTime;

import java.io.Serializable;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.fasterxml.jackson.annotation.JsonIgnore;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.springframework.format.annotation.DateTimeFormat;

/**
 * <p>
 *
 * </p>
 *
 * @author 芋头同学
 * @since 2021-08-20
 */
@Data
@EqualsAndHashCode(callSuper = false)
public class User implements Serializable {

    private static final long serialVersionUID = 1L;

    @ApiModelProperty(value = "用户 ID")
    @TableId(value = "user_id", type = IdType.ASSIGN_ID)
    private String userId;
    @ApiModelProperty(value = "用户账户")
    private String account;
    @ApiModelProperty(value = "用户密码")
    private String password;

    @JsonIgnore
    @TableLogic()
    @ApiModelProperty(value = "用户是否被删除")
    private Boolean isDelete;

    @ApiModelProperty(value = "用户创建时间")
    @TableField(fill = FieldFill.INSERT)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime createAt;

    @ApiModelProperty(value = "用户最后一次更新时间")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    private LocalDateTime updateAt;

    @JsonIgnore
    @ApiModelProperty(value = "用户版本")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Integer version;


    public User(String account, String password) {
        this.account = account;
        this.password = password;
    }
}
